package main

import (
	"fmt"
	"github.com/go-resty/resty/v2"
	"github.com/srlemon/gen-id/generator"
	"log"
)

// 机构
type Customer struct {
	FullName             string `json:"fullName"`
	LocationCode         string `json:"locationCode"`
	BizLocationCode      string `json:"bizLocationCode"`
	Nsrsbh               string `json:"nsrsbh"`
	Shxydm               string `json:"shxydm"`
	InternalUsableStatus string `json:"internalUsableStatus"`
	Source               string `json:"source"`
}



func main() {
	g := new(generator.GeneratorData)
	fullName := g.GeneratorName()

	customer := Customer{
		FullName:             fullName,
		LocationCode:         "130982",
		BizLocationCode:      "130000",
		Nsrsbh:               "",
		Shxydm:               "",
		InternalUsableStatus: "Y",
		Source:               "214649602167",
	}

	client := resty.New()

	headers := make(map[string]string)
	headers["Content-Type"] = "application/json"
	headers["appId"] = "20010100010000"
	headers["timestamp"] = "1467791956367"
	headers["appKey"] = "48778FFD44ADE08A462BF1EF3085BBD2D02613EF"

	resp, err := client.R().SetHeaders(headers).SetBody(customer).
		Post("http://cc-production.base-service-test.sit.91lyd.com/cc-production/test/company/saveOrUpdateAgency")

	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("fullName: ", fullName)
	fmt.Println("resp: ", resp)
}